<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 宏任务
    setTimeout(() => {
      console.log('setTimeout')
    }, 0)
    // pending 准备阶段
    // resolved 成功状态 fulfilled
    // rejected 拒绝状态
    console.log(new Promise((resolve, reject) => {
      setTimeout(() => {
        console.log('Promise内部setTimeout')
        resolve('成功状态')
      }, 0)
      console.log('promise') // 同步
      // reject('拒绝状态')
    }).then(value => {  
      // 微任务队列
      console.log('成功业务处理')
    }, reason => {
      console.log('拒绝业务处理')
    })
    )
    // 主线程 > 微任务 > 宏任务
    console.log('123')
  
  </script>
</body>
</html>
